<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('books', function (Blueprint $table) {
            $table->id();
            $table->string('title')->default('')->comment('图书标题');
            $table->string('img')->default('')->comment('图书封面');
            $table->tinyInteger('weight')->default(0)->comment('权重');
            $table->tinyInteger('status')->default(1)->comment('状态');
            $table->string('author')->default('')->comment('作者');
            $table->json('category_id')->comment('所属分类');
            $table->json('tag')->comment('标签');
            $table->tinyInteger('quantity')->default(0)->comment('库存');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('books');
    }
};
